

# - to ignore the error

.PHONY:clean

DNAME =.depend
P = $(shell  ls *.c )

VPATH = .depend ./
OBJ = $(patsubst %.c,%.o, $(P))

DEP = $(patsubst %.c,%.d, $(P))
INC = -I ../header/




cmd_cc_o_c     = CC  $(M)   $(PWD)/$@
cmd_cc_ld_c    = LD  $(M)   $(PWD)/$@
cmd_cc_dep_c   = DEP $(M)   $(PWD)/$*.d
silent = @




ifdef debug
ifeq ("$(debug)","1")
 silent       = 
 cmd_cc_o_c   = 
 cmd_cc_ld_c  = 
 cmd_cc_dep_c = 
endif
else 
	M = "  M   " 

endif



out: $(DNAME) $(OBJ) 
	@cc -Wall -o $@ main.c libSTR.a -I ../header/
	@echo  $(cmd_cc_ld_c)  


$(DNAME):
	mkdir -p $@

-include $(DNAME)/$(DEP)

%.o:%.c  ../header/
	@echo  $(cmd_cc_o_c)    
	 $(silent) gcc -c  $< -o $@   -I ../header/
	@echo $(cmd_cc_dep_c)
	$(silent) $(CC) -MM -MF   $(DNAME)/$*.d $<  $(INC)


clean:
	-rm  -f *.o
	 rm -rf $(DNAME)






#		 @sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
		            -e '/^$$/ d' -e 's/$$/ :/' < build/$*.P >> build/$*.d;
